<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
//aaaaa1111
        function ajaxCall(method, url, callBackFunction,data) {
            alert(2);
            var user={name:"",password:"",type:""};
            user.name="aaa";
            user.password="bbb";
            user.type="ccc";

            var httprequest = new XMLHttpRequest();
            httprequest.onreadystatechange = function() {
                if (httprequest.readyState == 4 && httprequest.status == 200) {
                    callBackFunction(httprequest.responseText);
                }
            }
            httprequest.open(method, url, true);
            httprequest.setRequestHeader("X-Requested-With", "AJAX");
            httprequest.send( JSON.stringify(user));
        }
        
        function test() {
            alert(1);
            ajaxCall("POST","TestServlet",aa,null);
        }
        function aa() {
            alert("aaa");
        }


    </script>
</head>
<body>
<input type="button"  onclick="test()" value="aaaa">
</body>
</html>